/**
 * 
 */
package org.karthik.ecomm.main;

import org.hibernate.Session;
import org.karthik.ecomm.dto.UserDetails;
import org.karthik.ecomm.util.HibernateUtil;

/**
 * This is the main class
 *
 */
public class HibernateMain {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		HibernateUtil sessionObject = new HibernateUtil();		
		UserDetails hari = new UserDetails(1002,"Hari","Hyderabad");
		UserDetails pranamya = new UserDetails(1003,"Pranamya","Bengaluru");
		
		Session session = sessionObject.getSession();
		
		session.beginTransaction();
		
		session.save(hari);
		session.save(pranamya);
		session.getTransaction().commit();
		
		System.out.println("session1 : " + session.hashCode() );
		
		Session session2 = sessionObject.getSession();
		
		System.out.println("session2 : " + session2.hashCode() );
	}

}
